strongswan: check return value instead of output
authorStijn Tintel <[email protected]>
Tue, 1 Aug 2017 01:29:45 +0000 (03:29 +0200)
committerStijn Tintel <[email protected]>
Mon, 7 Aug 2017 18:19:18 +0000 (20:19 +0200)
When the strongswan service is running, `ipsec status` returns 0. Check
the return value instead of checking its output.

While at it, remove the [[ ]] bashism, use rereadall instead of
(reread)secrets, and move it inside the if statement.

Signed-off-by: Stijn Tintel <[email protected]>
net/strongswan/files/ipsec.init

index af838a82347c74a3c6aa0d052680cc8be4d91454..0bbec766cf54fb208c7a4210550616555a85b98f 100644 (file)
@@ -331,8 +331,8 @@ restart() {
 
 reload() {
        prepare_env
-       ipsec secrets
-       if [[ ! -z "$(ipsec status)" ]]; then
+       if ipsec status > /dev/null 2>&1; then
+               ipsec rereadall
                ipsec reload
        else
                ipsec start